/* main.c : basic test for linked list */
 
/* standard header */
#include <stdlib.h>
#include <stdio.h>
 
/* our own header */
#include "list.h"
 
int main(int argc, char *argv[])
{
  size_t                len = 5, seed = 42, i;
  list                  l = list_empty() ;
 
  /* parameters handling ... */
  if (argc > 1)
    {
      /* some parameters ? the first is the seed */
      seed = atol(argv[1]);
      if (argc > 2 )
        /* the second is the len of the list */
        len = atol(argv[2]);
    }
 
  srandom(seed);
 
  /* list building ... */
  printf("Building list: ");
 
  for (i = 0; i < len; ++i)
    {
      int               x;
      x = random() % 100 ;
      printf(" %d;",x);
      l = list_add(l, x);
    }
 
  printf("\nBuild done.\n");
 
 
  /* now print it */
  printf("list_print(l): ");
  list_print(l);
  printf("\n");
 
  /* do some cleaning ... */
  list_destroy(l);
 
  return 0;
}

